{extend name="layout"}

{block name="content"}
<!-- wrapper-content -->
<div class="wrapper wrapper-content animated fadeInRight">

	<div class="row">

		<div class="col-lg-12">
			<div class="ibox ">
				<div class="ibox-title">
					<h5>修改菜单 《{$info.title}》</h5>
					<div class="ibox-tools">
						<a href="javascript:;" title="刷新" class="page-reload">
							<i class="fa fa-refresh"></i>
						</a>
						<a onclick="javascript:history.back(-1);return false;" href="javascricp:;" title="返回">
							<i class="fa fa-reply"></i>
						</a>
					</div>
				</div>
				<div class="ibox-content">
					<form action="{:url('admin/menu/edit')}" name="form-builder" method="post" id="form">
						<input type="hidden" name="id" value="{$info.id}">
						<div class="form-group row"><label class="col-sm-2 col-form-label"><span class="text-danger">*</span>父级菜单</label>
							<div class="col-md-10">
								<select class="form-control" name="pid">
									<option value="0">顶级菜单</option>
									{volist name="menu_list" id="vo"}
									<option value="{$vo.id}" {if $vo.id==$info.pid}selected {/if}>{$vo.title_display|raw} </option>
									{/volist} 
								</select> <span class="form-text m-b-none">尽量选择与所属模块一致的菜单</span>
							</div>
						</div>
						<div class="hr-line-dashed"></div>
						<div class="form-group row"><label class="col-sm-2 col-form-label"><span class="text-danger">*</span>菜单名称</label>
							<div class="col-md-10"><input type="text" name="title" placeholder="请输入菜单名称" value="{$info.title}" class="form-control">
							</div>
						</div>
						<div class="hr-line-dashed"></div>
						<div class="form-group row"><label class="col-sm-2 col-form-label"><span class="text-danger">*</span>模块名称</label>
							<div class="col-md-10"><input type="text" name="module" placeholder="请输入模块名称" value="{$info.module}" class="form-control"><span class="form-text m-b-none">模块格式：模块名：admin，请留意大小写</span>
							</div>
						</div>
						<div class="hr-line-dashed"></div>
						<div class="form-group row"><label class="col-sm-2 col-form-label"><span class="text-danger">*</span>控制器名</label>
							<div class="col-md-10"><input type="text" name="controller" placeholder="请输入控制器名" value="{$info.controller}" class="form-control"><span class="form-text m-b-none">模块格式：控制器名：Index，请留意大小写</span>
							</div>
						</div>
						<div class="hr-line-dashed"></div>
						<div class="form-group row"><label class="col-sm-2 col-form-label">方法名</label>
							<div class="col-md-10"><input type="text" name="action" placeholder="请输入方法名" value="{$info.action}" class="form-control"><span class="form-text m-b-none">模块格式：方法名：index，请留意大小写</span>
							</div>
						</div>
						<div class="hr-line-dashed"></div>
						<div class="form-group row"><label class="col-sm-2 col-form-label">图标</label>
							<div class="col-md-10"><input type="text" name="icon" placeholder="请输入图标" value="{$info.icon}" class="form-control"><span class="form-text m-b-none">直接填写图标URL。图标请参考此网址：<a href="https://fontawesome.dashgame.com" target="_blank">https://fontawesome.dashgame.com/</a></span>
							</div>
						</div>
						<div class="hr-line-dashed"></div>
						<div class="form-group row"><label class="col-sm-2 col-form-label"><span
									class="text-danger">*</span>排序</label>
							<div class="col-md-10"><input type="number" name="sort" class="form-control" value="{$info.sort}" placeholder="请输入排序">
							</div>
						</div>
						<div class="hr-line-dashed"></div>
						<div class="form-group row"><label class="col-sm-2 col-form-label">状态</label>
							<div class="col-md-10 pt-2">
								<div class="radio radio-success d-inline pl-0 {if $info.status==1}radio-inline {/if}">
									<input type="radio" id="status1" value="1" name="status" {if $info.status==1}checked="" {/if}> <label
										for="status1"> 开启 </label>
								</div>
								<div class="radio radio-success d-inline {if $info.status==2}radio-inline{/if}">
									<input type="radio" id="status2" value="2" name="status" {if $info.status==2}checked="" {/if}> <label
										for="status2"> 关闭 </label>
								</div>
							</div>
						</div>
						<div class="hr-line-dashed"></div>
						<div class="form-group row">
							<div class="col-sm-12 col-sm-offset-2">
								<button class="btn btn-primary btn-lg btn-w-m ajax-post" target-form="form-builder"
									type="submit">提交</button>
								<button class="btn btn-default btn-lg" type="button"
									onclick="javascript:history.back(-1);return false;">返回 </button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>

{/block}
{block name="script"}
<script>
	$(document).ready(function () {
		$("#form").validate({
			rules: {
				title: {
					required: true,
					minlength: 3
				},
				module: {
					required: true
				},
				controller: {
					required: true
				},
				sort: {
					required: true
				},
				pid: {
					required: true
				}
			},
			messages: {
				title: {
					required: "请输入菜单名称",
					minlength: "菜单名称长度不能小于3"
				},
				module: {
					required: "请输入模块名称",
				},
				controller: {
					required: "请输入控制器名",
				},
				sort: {
					required: "请输入排序数字",
				},
				pid: {
					required: "请选择父级菜单",
				}
			}
		});
	});
</script>
{/block}